﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace Futaba.SBus.Telemetry.Configuration
{
	/// <summary>
	/// Specifies the configuration of a telemetry sensor and all the parameters (slots)
	/// it transports
	/// </summary>
	//[XmlRoot(Namespace=KnownNamespaces.Sbus2Namespace)]
	public class Sensor
	{
		/// <summary>
		/// The base type of this sensor
		/// </summary>
		[XmlAttribute("sensorType")]
		public SensorType SensorType { get; set; }
		/// <summary>
		/// An arbitrary displayname for this sensor
		/// </summary>
		[XmlAttribute("displayName")]
		public string DisplayName { get; set; }
		/// <summary>
		/// The model name, as it appears in the generated CSV-Telemetry file for this sensor
		/// </summary>
		[XmlAttribute("model")]
		public string Model { get; set; }
		/// <summary>
		/// The ID identifying this Sensor in the FLI file
		/// </summary>
		[XmlAttribute("fliId")]
		public byte FliId { get; set; }
		/// <summary>
		/// The list of sensor-values (Slots) occupied/sent by this sensor
		/// </summary>
        [XmlArrayItem("Parameter")]
		public SensorParameter[] Parameters { get; set; }

		/// <summary>
		/// Returns an informative string of this instance
		/// </summary>
		public override string ToString()
		{
			return string.Format("Sensor {0} ({1})", SensorType, DisplayName);
		}
	}
}
